package com.changgou.config.controller;


import com.changgou.config.pojo.Area;
import com.changgou.config.service.AreaService;
import com.changgou.entity.PageResult;
import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/areaController")
public class AreaController {

    @Autowired
    private AreaService areaService;

    /**
     * 省市区联动查询
     * @return
     */
    @GetMapping("/findAllArea")
    public Result findAllArea(){
        List<Area> allArea = areaService.findAllArea();
        return new Result(true, StatusCode.OK,"查询成功",allArea);

    }
}
